<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">

<title>My JSP 'list.jsp' starting page</title>

<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/css/content.css">
<style type="text/css">
#down table {
	position: relative;
	left: 50%;
	margin-left: -500px;
	top: 50px;
	border-top: 1px #999 solid;
	border-right: 1px #999 solid;
}

#down tr {
	height: 60px;
}

#down tr td {
	text-align: center;
	border-left: 1px #999 solid;
	border-bottom: 1px #999 solid;
}

#up a:VISITED, #up a:LINK {
	color: #4C8FBD;
	text-decoration: none;
}

#up a:HOVER {
	color: #4C8FBD;
	text-decoration: none;
}

.head {
	background: #438EB9;
	color: #fff;
}

tbody tr:nth-child(odd) {
	background: #e5e5e5;
}

tbody tr:nth-child(even) {
	background: #d5d5d5;
}

/* 以下是搜索框css  */
.form-wrapper {
	width: 450px;
	padding: 8px;
	margin-top:10px;
	margin-left:390px;
	overflow: hidden;
	border-width: 1px;
	border-style: solid;
	border-color: #dedede #bababa #aaa #bababa;
	-moz-border-radius: 10px;
	-webkit-border-radius: 10px;
	border-radius: 10px;
	background-color: #f6f6f6;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#f6f6f6),
		to(#eae8e8));
	background-image: -webkit-linear-gradient(top, #f6f6f6, #eae8e8);
	background-image: -moz-linear-gradient(top, #f6f6f6, #eae8e8);
	background-image: -ms-linear-gradient(top, #f6f6f6, #eae8e8);
	background-image: -o-linear-gradient(top, #f6f6f6, #eae8e8);
	background-image: linear-gradient(top, #f6f6f6, #eae8e8);
}

.form-wrapper #search {
	width: 330px;
	height: 40px;
	padding: 10px 5px;
	float: left;
	font: bold 16px 'lucida sans', 'trebuchet MS', 'Tahoma';
	border: 1px solid #ccc;
	-moz-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
	-webkit-box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
	box-shadow: 0 1px 1px #ddd inset, 0 1px 0 #fff;
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
}

.form-wrapper #search:focus {
	outline: 0;
	border-color: #aaa;
	-moz-box-shadow: 0 1px 1px #bbb inset;
	-webkit-box-shadow: 0 1px 1px #bbb inset;
	box-shadow: 0 1px 1px #bbb inset;
}

.form-wrapper #search::-webkit-input-placeholder {
	color: #999;
	font-weight: normal;
}

.form-wrapper #search:-moz-placeholder {
	color: #999;
	font-weight: normal;
}

.form-wrapper #search:-ms-input-placeholder {
	color: #999;
	font-weight: normal;
}

.form-wrapper #submit {
	float: right;
	border: 1px solid #00748f;
	height: 42px;
	width: 100px;
	padding: 0;
	cursor: pointer;
	font: bold 15px Arial, Helvetica;
	color: #fafafa;
	text-transform: uppercase;
	background-color: #0483a0;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#31b2c3),
		to(#0483a0));
	background-image: -webkit-linear-gradient(top, #31b2c3, #0483a0);
	background-image: -moz-linear-gradient(top, #31b2c3, #0483a0);
	background-image: -ms-linear-gradient(top, #31b2c3, #0483a0);
	background-image: -o-linear-gradient(top, #31b2c3, #0483a0);
	background-image: linear-gradient(top, #31b2c3, #0483a0);
	-moz-border-radius: 3px;
	-webkit-border-radius: 3px;
	border-radius: 3px;
	text-shadow: 0 1px 0 rgba(0, 0, 0, .3);
	-moz-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
	-webkit-box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
	box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 #fff;
}

.form-wrapper #submit:hover, .form-wrapper #submit:focus {
	background-color: #31b2c3;
	background-image: -webkit-gradient(linear, left top, left bottom, from(#0483a0),
		to(#31b2c3));
	background-image: -webkit-linear-gradient(top, #0483a0, #31b2c3);
	background-image: -moz-linear-gradient(top, #0483a0, #31b2c3);
	background-image: -ms-linear-gradient(top, #0483a0, #31b2c3);
	background-image: -o-linear-gradient(top, #0483a0, #31b2c3);
	background-image: linear-gradient(top, #0483a0, #31b2c3);
}

.form-wrapper #submit:active {
	outline: 0;
	-moz-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
	-webkit-box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.5) inset;
}

.form-wrapper #submit::-moz-focus-inner {
	border: 0;
}
</style>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/jquery-3.1.1.min.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/delete.js" charset="UTF-8"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/js/admin_main_js/jquery.min.js"></script>


</head>

<body>
	<div id="up">
		<ul>
			<li><span><a href="admin/welcome">平台首页 </a>&gt; 商品管理 &gt;
					商品列表</span></li>
		</ul>
	</div>

	<form action="product/selectproduct" class="form-wrapper">
		<table width="1000px" cellpadding="0" cellspacing="0">
			<tr>
				<td><select name="style" class="in" >
						<option>--请选择条件--</option>
						<option value="0">按名称</option>
						<option value="1">按状态</option>
						<option value="2">按分类</option>
						<option value="3">按折扣</option>
				 </select>
				 
                <a href="product/add" target="con"><right>商品添加</right></a></td>
                 
				<input type="text" id="search" name="str" value="${name}"placeholder="请输入条件"required>
				<input type="submit" value="搜索" id="submit">
			</tr>

		</table>
	</form>


	<div id="down">
		<table width="1000px" cellpadding="0" cellspacing="0">
			<thead>
				<tr class="head">
					<td>序号</td>
					<td>商品名称</td>
					<td>商品价格</td>
					<td>商品库存</td>
					<td>商品销量</td>
					<td>商品折扣</td>
					<td>商品状态</td>
					<td>商品类别</td>
					<td>操作</td>
				</tr>
			</thead>
			<tbody>
				<c:forEach items="${products }" var="product" varStatus="i">
					<tr
						title="商品详情：${product.describe }商品售价：${product.price * product.discount }">
						<td>${i.index + 1 }</td>
						<td>${product.name }</td>
						<td>${product.price }</td>
						<td>${product.inventory }</td>
						<td>${product.sales }</td>
						<td>${product.discount }</td>
						<td><c:if test="${product.status eq 0 }">下架</c:if> <c:if
								test="${product.status eq 1 }">普通</c:if> <c:if
								test="${product.status eq 2 }">热销</c:if> <c:if
								test="${product.status eq 3 }">特色</c:if></td>
						<td>${product.category.name}</td>
						<td><a href="product/${product.id }">图片修改</a>&nbsp; 
						<a href="product/${product.id }/update">修改</a>&nbsp;
						<a href="product/${product.id }/delete" class="del">删除</a>&nbsp;
						<input id="describe" type="button" class="describe" name="${product.describe}" value="详情">
						</td>
					</tr>
				</c:forEach>
			</tbody>
		</table>
	</div>
	<form action="" method="post">
		<input type="hidden" name="_method" value="DELETE">
	</form>
<script type="text/javascript" src="<%=request.getContextPath()%>/js/admin_main_js/detail.js"></script>
</body>
</html>
